package com.foreknow.demo3;

import java.util.Scanner;

/**
 *  *      **********************************************
 *  *      1. fender       2. gibson      3. yamaha
 *  *      **********************************************
 *  *      请选择某个商品 1
 *  *      可以将某个商品设置价格
 *  *      显示商品的名称和商品的价格
 *  *      询问用户是否继续(y/n)
 */
public class LoopDemo2 {
    public static void main(String[] args) {
        System.out.println("*****************商品管理系统****************");
        System.out.println("请选择商品的编号:");
        System.out.println("**********************************************");
        System.out.println("1. fender       2. gibson      3. yamaha");
        System.out.println("**********************************************");
        Scanner input = new Scanner(System.in);
        String name = "";
        double price = 0.0;
        String answer = "y";
        while (answer.equals("y")){
            System.out.println("请选择商品的编号: ");
            int num = input.nextInt();
            switch (num){
                case 1:
                    name = "fender";
                    price = 12345.56;
                    break;
                case 2:
                    name = "gibson";
                    price = 222222.56;
                    break;
                case 3:
                    name = "yamaha";
                    price = 233333.56;
                    break;
            }
            System.out.println(name + "----------" + price);
            System.out.println("是否继续(y/n)");
            answer = input.next();
        }
        System.out.println("Over.......");

    }
}
